package com.lemon.secondhandplatform.mode;

import java.util.UUID;

import cn.bmob.v3.BmobObject;
import cn.bmob.v3.datatype.BmobDate;

/**
 * 用户
 */
public class User extends BmobObject {

    //用户名
    private String username;
    //密码
    private String password;
    //昵称
    private String nickname;
    //头像地址
    private String avator;
    //性别
    private String sex;
    //电话
    private Integer phone;
    //邮箱
    private String email;
    //生日
    private BmobDate birthday;

    public User() {
        nickname = UUID.randomUUID().toString();
        sex = "男";
        birthday = BmobDate.createBmobDate("yyyy-MM-dd", "1970-01-01");
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getAvator() {
        return avator;
    }

    public void setAvator(String avator) {
        this.avator = avator;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getPhone() {
        return phone;
    }

    public void setPhone(Integer phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public BmobDate getBirthday() {
        return birthday;
    }

    public void setBirthday(BmobDate birthday) {
        this.birthday = birthday;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof User) {
            String objectId = ((User) obj).getObjectId();
            return this.getObjectId().equals(objectId);
        }

        return false;
    }
}
